package com.runjian.rundo.iot.agent.business.publisher;

import org.springframework.context.ApplicationContext;

import com.runjian.rundo.bmp.kernel.common.spring.context.utils.SpringUtils;
import com.runjian.rundo.iot.agent.business.event.DeviceEvent;

import lombok.extern.slf4j.Slf4j;

/**
 * 设备事件发布器
 *
 * @author LiPan
 */
@Slf4j
public class DeviceEventPublisher {

    private static final ApplicationContext applicationContext;

    static {
        applicationContext = SpringUtils.getApplicationContext();
    }

    /**
     * 发布控制成功响应事件
     */
    public static void publishDeviceEvent(DeviceEvent deviceEvent) {
        log.info("[设备控制响应] 开始发布设备控制成功响应");
        applicationContext.publishEvent(deviceEvent);
    }

}
